Skip to content

bugfix: fix biomass component gaps (BGB coverage and tree/all discrepancies) - #17

Merged
Cidree merged 5 commits into
mainfrom
avv-fix-biomass-component-gaps
Jun 20, 2026
Merged

bugfix: fix biomass component gaps (BGB coverage and tree/all discrepancies)#17
Cidree merged 5 commits into
mainfrom
avv-fix-biomass-component-gaps

Conversation

@aitorvv

@aitorvv aitorvv commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes silent gaps and errors when requesting roots (BGB) or total tree equations on biomass models that do not support them. It replaces generic failures with targeted cli::cli_abort() messages and adds detailed documentation on model coverage and discrepancies (such as the independent regression nature of total tree biomass in Montero 2005).

Verification

# Inspect new/modified datasets
devtools::load_all()

# Verify custom errors for BGB/total-tree gaps
# 1. Ruiz-Peinado 2011: BGB gap for Abies pinsapo
try(eq_biomass_ruiz_peinado_2011("Abies pinsapo", "BGB"))

# 2. Dieguez-Aranda 2009: total-tree gap (needs to be calculated as sum of components)
try(eq_biomass_dieguez_aranda_2009("Pinus pinaster", "tree"))

# 3. Montero 2005: roots = NA error validation
try(eq_biomass_montero_2005("Abies pinsapo", "BGB"))

aitorvv added 5 commits May 17, 2026 11:03
- Add rcd and bp parameters to silv_predict_biomass(); rcd defaults to
  diameter when not provided, bp defaults to NA_real_
- Replace model-specific dispatch (ruiz-peinado only) with universal
  calc_biomass() inner function using eval_env = list(d,h,rcd,bp);
  now all 7 allometric models work out of the box
- Add return_rmse / return_r2 handling inside calc_biomass()
- Fix eq_biomass_cudjoe_2024() returning equation = 'cudjoe-2017' instead
  of 'cudjoe-2024'

Documentation (Roxygen2):
- silv_predict_biomass(): add @param rcd/@param bp; @details lists all 7
  models with input-variable requirements (rcd/bp for menendez-2022)
- eq_biomass_ruiz_peinado_2011(): add explicit softwood species list (10)
  and component hierarchy (AGB/BGB -> structural groups -> components)
- eq_biomass_ruiz_peinado_2012(): add explicit hardwood species list (13)
  and component hierarchy; fix missing comma in @Seealso
- eq_biomass_dieguez_aranda_2009(): rewrite @details with consistent
  format; fix typo 'Pinaster radiata' -> 'Pinus radiata'
- eq_biomass_montero_2005(): replace 'There are 35 species' with explicit
  bulleted species list; add component hierarchy; fix @Seealso comma
- eq_biomass_manrique_2017(): rewrite @details in structured format; fix
  'thin branches' -> 'small branches' to match biomass_models column
- eq_biomass_menendez_2022(): correct species count 15 -> 18 + 3
  functional groups; add non-standard input note (rcd/bp)
- eq_biomass_cudjoe_2024(): rewrite @details in structured format; fix
  'brances' typo in component name

README.md:
- Add 'Suggested companion reading' section with poster DOI
  https://doi.org/10.13140/RG.2.2.28098.75205

inst/references.bib:
- Resolve unresolved merge conflict: keep menendez-2022 and cudjoe-2024
  entries (HEAD), discard palahi-2003 (other branch)
- Add poster BibTeX entry (vazquez-veloso_poster_2025)
…issing BGB and total tree components and update Roxygen2 docs
@Cidree
Cidree merged commit 4102cdb into main Jun 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants